package com.dr.controller;

import java.util.List;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.dr.pojo.User;
import com.dr.service.UserService;

@Controller
public class UserController {
	@Autowired
	private UserService service;

	@RequestMapping("/userList")
	public ModelAndView login(User user, HttpSession session) {
		List<User> userList = service.findUserList();//取得用户列表数据
		
		ModelAndView mav = new ModelAndView();
		mav.addObject("userList",userList);//加载到用户列表页面中，相当于执行request.setAttribute("userList",userList);
		mav.setViewName("userManage/userList.jsp");//设定跳转页面
		return mav;
	}
}
